< previous page page_302 next page >

Page 302
End If
cmdSave.Enabled = Not cmdSave.Enabled
cmdNew.Enabled = Not cmdNew.Enabled
cmdDelete.Enabled = Not cmdDelete.Enabled
datEmployees.Enabled = Not datEmployees.Enabled
cmdNext.Enabled = Not cmdNext.Enabled
cmdPrevious.Enabled = Not cmdPrevious.Enabled
cmdFirst.Enabled = Not cmdFirst.Enabled
cmdLast.Enabled = Not cmdLast.Enabled
End Sub
analysis.gifThe cmdNext and cmdPrevious command buttons have the most code because you need to perform EOF and BOF checks. If you attempt to move to the phantom records, youll need to move back off of them because you dont want a blank row to display on the screen.

Finding Records
With the current form design, the user either has to move through every record, one by one, to find a particular employee or scroll through the list box. You may want to add a Find command button to the form to allow the user to input a last name in a search operation.
EXERCISE
Add a Find Command Button
1. Add a command button to the form and place it under the list box.
2. Set the Name property to cmdFind.
3. Set the Caption property to &Find.
4. Double-click the command button to bring up a code window.
5. Type in the following code:
Private Sub cmdFind_Click()
Dim strLast As String
Dim vntBookmark As Variant

strLast = InputBox("Enter Employee Last Name", _
"Find Employee")

 
< previous page page_302 next page >

If you like this book, buy it!